home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / gfx / show / swfplayersrc.lha / Player / openurl.c < prev    next >
C/C++ Source or Header  |  2002-11-05  |  2KB  |  77 lines

  1. /*
  2. **
  3. ** $VER: openurl.c 0.5 (05.11.02)
  4. ** Description
  5. **
  6. ** (C) Copyright 1999 Paul Hill
  7. ** (C) Copyright 2002 Alexandre Balaban
  8. **
  9. ** $HISTORY :
  10. **        - 0.5, 05.11.02 : Corrected implicit declaration of printf (from TRACE macro)
  11. **        - 0.4, 09.10.02 : Improve PPC compilation again
  12. **        - 0.3, 03.10.02 : Include PPC compilation improvements by Steffen Haeuser
  13. **      - 0.2, 27.07.02 : Cleanup
  14. **      - 0.1, 08.03.99 : Original version by Paul Hill
  15. **
  16. */
  17.  
  18. #include <stdio.h>
  19. #ifndef __PPC__
  20.  
  21. #include <proto/exec.h>
  22. #include <libraries/openurl.h>
  23. #include <proto/openurl.h>
  24. #include <clib/openurl_protos.h>
  25. #include <pragmas/openurl_pragmas.h>
  26.  
  27. #endif // __PPC__
  28.  
  29. #include "swfplayer.h" // for TRACE macro
  30.  
  31. #ifndef __PPC__
  32.  
  33. #pragma tagcall OpenURLBase URL_OpenA 1E 9802
  34.  
  35. struct Library *OpenURLBase = NULL;
  36.  
  37. extern __inline BOOL
  38. URL_OpenA( STRPTR url, struct TagItem *tags)
  39. {
  40.   register BOOL res __asm("d0");
  41.   register struct Library *a6 __asm("a6") = OpenURLBase;
  42.   register STRPTR a0 __asm("a0") = url;
  43.   register struct TagItem *a1 __asm("a1") = tags;
  44.   __asm volatile ("jsr a6@(-0x1e:W)"
  45.     : "=r" (res)
  46.     : "r" (a6), "r" (a0), "r" (a1)
  47.     : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  48.   return res;
  49. }
  50. #endif // !__PPC__
  51.  
  52. void showUrl(char *url, char *target, void *client_data)
  53. {
  54.   TRACE("OPENURL [%s] [%s] [%p]\n",url,target,client_data);
  55.  
  56.   #ifndef __PPC__
  57.   /* attempt to open the OpenUrl.library if it's not already open */
  58.   if (!OpenURLBase)
  59.   {
  60.     OpenURLBase = OpenLibrary("openurl.library", 1);
  61.   }
  62.  
  63.   if (OpenURLBase)
  64.   {
  65.     ULONG tags[] = { URL_NewWindow, FALSE, TAG_DONE };
  66.     if (URL_OpenA((STRPTR)url, (struct TagItem*)&tags))
  67.     {
  68.       TRACE("OK\n");
  69.     }
  70.   }
  71.   else
  72.   {
  73.     printf("GetURL : %s\n", url);
  74.   }
  75.   #endif // !__PPC__
  76. }
  77.